<template>
	<div >
		<!--大数据分析初中部-->
		<Row style="margin-top: 20px;margin-bottom: 20px;">
	        <Col span="6">
	        	<span>届别：</span>
				<Select v-model="sectorSelect" style="width:150px" @on-change="sectorSelectChange">
			        <Option v-for="item in sectorList" :value="item.value" :key="item.value">{{ item.label }}</Option>
			    </Select>
	        </Col>
	        <Col span="6">
	        	<span>年级：</span>
				<Select v-model="gradeSelect" style="width:150px" @on-change="gradeSelectChange">
			        <Option v-for="item in gradeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
			    </Select>
	        </Col>
	        <Col span="6">
	        	<span>学年：</span>
				<Select v-model="studyYearSelect" style="width:150px" @on-change="studyYearSelectChange">
			        <Option v-for="item in studyYearList" :value="item.value" :key="item.value">{{ item.label }}</Option>
			    </Select>
	        </Col>
	        <Col span="6">
	        	<span>科目：</span>
				<Select v-model="subjectselect" style="width:150px" @on-change="subjectselectChange">
			        <Option v-for="item in subjectlist" :value="item.value" :key="item.value">{{ item.label }}</Option>
			    </Select>
	        </Col>
	    </Row>
	    
	    <div class="dataanalysis">
	    	<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
	    	<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">最高分趋势图</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_max" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
			<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
			<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">最低分趋势图</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_min" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
			<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
			<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">平均分趋势图</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_average" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
			<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
			<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">优秀率趋势图</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_excellence" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
			<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
			<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">及格率趋势图</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_pass" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
			<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
			<Row style="text-align: left;margin-top: 41px;">
				<Col span="12" style="text-align: left;">
	    			<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
	    			<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">低分率趋势图</span>
	    			<span style="font-size: 12px;margin-left: 12px;color: rgba(102, 102, 102, 0.61);">低于总分的40%为低分</span>
				</Col>
				<!--<Col span="11" style="text-align: right;">
		        	<Select style="width:80px;text-align: center;" v-model="subjectselect" type="button" @on-change="changeselect">
		        		<Option v-for="item in subjectlist" :key="item.value" :value="item.value">{{item.label}}</Option>
				    </Select>
		       </Col>-->
			</Row >
		    <Row style="text-align: left;margin-top: 0px;padding-bottom: 20px;">
				<div>
	    			<!--<p style="font-size: 16px;font-weight: 600;margin-left: 45px;text-align: left;">语文科：</p>-->
	    		</div>
				<div id="myChart" ref="line_lowscore" :style="{width: '95%', height: '250px',margin:'0 auto'}"></div>
			</Row >
			
	    </div>
	    
	    
	</div>
</template>

<script>
	import { getsessionstorage } from '@/components/js/Localstorage'
	import api from "@/components/js/Apidomain.js"
	export default{
		data(){
			return{
				sectorSelect:"",
				gradeSelect:"",
				studyYearSelect:"",
				subjectselect:"",
				
				sectorList:[
//					{value: '1',label: '2017'},
//					{value: '2',label: '2018'},
//					{value: '3',label: '2019'}
				],
				gradeList:[
//					{value: '1',label: '2017'},
//					{value: '2',label: '2018'},
//					{value: '3',label: '2019'}
				],
				studyYearList:[
//					{value: '1',label: '2017'},
//					{value: '2',label: '2018'},
//					{value: '3',label: '2019'}
				],
				subjectlist:[
//					{value: '1',label: '语文'},
//					{value: '2',label: '数学'},
//					{value: '3',label: '英语'}
				],
				
				
				
				linedata_max:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						}
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
				linedata_min:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						}
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
				linedata_average:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						}
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
				linedata_excellence:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						},
						axisLabel:{
			            	formatter:'{value} %'
			            },
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
				linedata_pass:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						},
						axisLabel:{
			            	formatter:'{value} %'
			            },
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
				linedata_lowscore:{
				    title: {
				        text: '',
				        textStyle:{
				        	fontSize:"15",
				        }
				    },
				    tooltip: {
				        trigger: 'axis'
				    },
//				    legend: {
////				        data:['邮件营销','联盟广告','视频广告'],
////						selectedMode: 'single',		//多选单选模式
//				    },
				    grid: {
				        left: '2%',
				        right: '5%',
				        bottom: '2%',
				        top:'5%',
				        containLabel: true
				    },
				    xAxis: {
				        type: 'category',
				        boundaryGap: false,
				        data: "",
//				        data: ['周一','周二','周三','周四','周五','周六','周日']
						axisTick: {
			                alignWithLabel: true
			            },
			            axisLabel: {
                                            interval: 0,
                                            formatter:function(value)
                                            {
                                                
                                                var ret = "";//拼接加\n返回的类目项
                                                var maxLength = 6;//每项显示文字个数
                                                var valLength = value.length;//X轴类目项的文字个数
                                                var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
                                                if (rowN > 1)//如果类目项的文字大于3,
                                                {
                                                    for (var i = 0; i < rowN; i++) {
                                                        var temp = "";//每次截取的字符串
                                                        var start = i * maxLength;//开始截取的位置
                                                        var end = start + maxLength;//结束截取的位置
                                                        //这里也可以加一个是否是最后一行的判断，但是不加也没有影响，那就不加吧
                                                        temp = value.substring(start, end) + "\n";
                                                        ret += temp; //凭借最终的字符串
                                                    }
                                                    return ret;
                                                }
                                                else {
                                                    return value;
                                                }
                                            }
                                        }

				    },
				    yAxis: {
				        type: 'value',
				        min: function(value) {
						    return parseInt(value.min) ;
						},
						axisLabel:{
			            	formatter:'{value} %'
			            },
				    },
				    series: [
//				    	{
//				            name:'邮件营销',
//				            type:'line',
//				            data:[120, 132, 101, 134, 90, 230, 210]
//				       },
				    ]
				},
			}
		},
		created(){
			this.getSectorlist()
		},
		mounted() {
        	
        },
		methods:{
			drawLine_max() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_max,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_max);
                })
           	},
           	drawLine_min() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_min,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_min);
                })
           	},
           	drawLine_average() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_average,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_average);
                })
           	},
           	drawLine_excellence() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_excellence,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_excellence);
                })
           	},
           	drawLine_pass() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_pass,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_pass);
                })
           	},
           	drawLine_lowscore() {
        		this.$nextTick(function () {
	                let myChart = this.$echarts.init(this.$refs.line_lowscore,'hengyi')
	                myChart.clear();
	                myChart.setOption(this.linedata_lowscore);
                })
           	},
           	//获取界别选择列表
			getSectorlist:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/tchGrade/getPeriod';
            	this.$http.post(url, {"type":"Middle"}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.sectorList = response.data.data
						if(self.sectorList.length != 0){
							self.sectorSelect = self.sectorList[0].value;
							self.getgradelist();
						}
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00230',
							duration: 10,
							closable: true
						});
					});
           	},
           	sectorSelectChange:function(){
           		this.getgradelist()
           	},
           	//获取年级选择列表
			getgradelist:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/tchGrade/getGradeByPeriod';
            	this.$http.post(url, {"type":"Middle","period":this.sectorSelect}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.gradeList = response.data.data
						if(self.gradeList.length != 0){
							self.gradeSelect = self.gradeList[0].value;
							self.getStudyYearList()
						}
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00231',
							duration: 10,
							closable: true
						});
					});
           	},
           	gradeSelectChange:function(){
           		this.getStudyYearList()
           	},
           	//获取学年选择列表
           	getStudyYearList:function(){
           		var self = this;
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getQuerySchoolYearSelect';
            	this.$http.post(url,{"gradeId":this.gradeSelect}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.studyYearList = response.data.data
						if(self.studyYearList.length != 0){
							self.studyYearSelect = self.studyYearList[0].value;
							self.getSubjectList()
						}
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00232',
							duration: 10,
							closable: true
						});
					});
           	},
           	studyYearSelectChange:function(){
           		this.getSubjectList()
           	},
           	//获取学年选择列表
           	getSubjectList:function(){
           		var self = this;
           		let roleId = getsessionstorage("roleid");
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getQuerySubject';
            	this.$http.post(url,{"roleId":roleId}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.subjectlist = response.data.data
						if(self.subjectlist.length != 0){
							self.subjectselect = self.subjectlist[0].value;
							self.getLinedata()
						}
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00233',
							duration: 10,
							closable: true
						});
					});
           	},
           	subjectselectChange:function(){
           		this.getLinedata()
           	},
           	//获取折线图数据
			getLinedata:function(){
//				this.chartshow = true;
				var self = this;
            	let url = api.apidomain+'/tqes/web/squaAnalysisSubject/getSquaAnalySubject';
            	this.$http.post(url, {"gradeId":this.gradeSelect,
									"subjectId":this.subjectselect,
									"schoolYearStart":this.studyYearSelect}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.linedata_max.xAxis.data = response.data.data.maxResultName;
						self.linedata_max.series = response.data.data.maxResultData; 
						self.linedata_min.xAxis.data = response.data.data.minResultName;
						self.linedata_min.series = response.data.data.minResultData; 
						self.linedata_average.xAxis.data = response.data.data.averageName;
						self.linedata_average.series = response.data.data.averageData; 
						self.linedata_excellence.xAxis.data = response.data.data.excellentRateName;
						self.linedata_excellence.series = response.data.data.excellentRateData; 
						self.linedata_pass.xAxis.data = response.data.data.passRateName;
						self.linedata_pass.series = response.data.data.passRateData; 
						self.linedata_lowscore.xAxis.data = response.data.data.lowScoreRateName;
						self.linedata_lowscore.series = response.data.data.lowScoreRateData; 
						//$nexttick为了使tch = true生效（dom）变化后再执行drawline，这样才不会有报错误
						self.$nextTick(function () {
							self.drawLine_max();
				        	self.drawLine_min();
				        	self.drawLine_average();
				        	self.drawLine_excellence();
				        	self.drawLine_pass();
				        	self.drawLine_lowscore();
						})
	            }else if(response.data.success == false){
	            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
	            	}
				})
				.catch(function(error) {
					self.$Message.error({
							content: '系统发生错误：错误码00234',
							duration: 10,
							closable: true
						});
				});
			},
		}
	}
</script>

<style lang="css" scoped>
	.dataanalysis >>> .ivu-select-single .ivu-select-selection{
		border: none;
    	border-radius: 0px
	}
</style>